package com.itheima.day09_IO;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class InputStreamTest4 {
    public static void main(String[] args) {
        read2();
    }

    public static void read2() {
        //TODO 一次读取多个字节
        try (FileInputStream fis = new FileInputStream("D:\\img2\\a.txt")) {
            int len;
            byte[] bytes = new byte[1024];
            while ((len = fis.read(bytes)) != -1) {
                System.out.println(new String(bytes, 0, len));
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}